Skip to content

gocache/awscache/blobserver: queue fills past the concurrency limit - #25

Merged
tomhjp merged 1 commit into
mainfrom
tomhjp/bump-concurrency
Nov 24, 2026
Merged

tomhjp merged 1 commit into
mainfrom
tomhjp/bump-concurrency

Conversation

@tomhjp

@tomhjp tomhjp commented Nov 24, 2026

Copy link
Copy Markdown
Member

Raise the limit of fills from S3 in progress from 64 to 1024.

Before, a GET miss or a POST past the limit dropped the fill, so whether a hot blob got onto disk depended on how many other fills were in progress at that moment. Now the server still sends 404 at once on a GET miss, but it puts the blob in a FIFO queue of fills. When a fill ends, its goroutine starts the next fill in the queue, skipping blobs that are now on disk. A blob is in the queue at most once. The queue holds at most 1,000,000 blobs, so that its memory is bounded; only past that does the server drop a fill.

Add the gocache_blobserver_fills_queued gauge and the "queued" result of gocache_blobserver_warms_total. The "busy" result now means that the queue is full.

Updates tailscale/corp#51930

@tomhjp
tomhjp requested a review from a team November 24, 2026 13:49

@winckler winckler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this PR is making two main changes: creates the queue and increase the maxFills at the same time.

My suggestion is to implement the queue first, keeping the maxFills, and than looking at the data, to see if the maxFills need to be increased. My worry is that too much concurrency might decrease the performance, and will be hard to observe if we make both changes at once.

Raise the limit of fills from S3 in progress from 64 to 128. The
comment on maxFills gives the estimates of peak S3 GETs/s and throughput
for 64, 128, and 256 fills, from the blob sizes in production and the S3
Standard latencies of a first read after a write.

Before, a GET miss or a POST past the limit dropped the fill, so whether
a hot blob got onto disk depended on how many other fills were in
progress at that moment. Now the server still sends 404 at once on a GET
miss, but it puts the blob in a FIFO queue of fills. When a fill ends,
its goroutine starts the next fill in the queue, skipping blobs that are
now on disk. A blob is in the queue at most once. The queue holds at
most 1,000,000 blobs, so that its memory is bounded; only past that does
the server drop a fill.

Add the gocache_blobserver_fills_queued gauge and the "queued" result of
gocache_blobserver_warms_total. The "busy" result now means that the
queue is full.

Updates tailscale/corp#51930

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
@tomhjp
tomhjp force-pushed the tomhjp/bump-concurrency branch from 6319c39 to 2f523da Compare November 24, 2026 17:23
@tomhjp

tomhjp commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

I bumped the concurrency down to 128 with some justification based on our current production load and some measurements I took while benchmarking S3. I think this is pretty conservative now, and has better reasoning - 64 was just plucked out of thin air before 😄

@tomhjp
tomhjp merged commit 9c61c7c into main Nov 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants